package com.hooper.hosp.utils;

import com.hooper.hosp.model.hosp.Schedule;
import org.springframework.data.domain.*;

/**
 * @author Tim Hooper
 * @version 1.0
 * @time 2022/09/28/21:13
 */
public class MongoPageUtils<T> {


    public static Pageable getPageable(int page,int limit){
        return PageRequest.of(page - 1, limit);
    }

    public static<T> Example<T> getExample(T entity){
        ExampleMatcher matcher = ExampleMatcher.matching()
                .withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING)
                .withIgnoreCase(true);
        return Example.of(entity, matcher);
    }
}
